#pragma once
#include "EnemyObject.h"
#include "Logging.h"
#include "ZoneObject.h"

#include <map>
#include <string>
#include <iostream>
#include <fstream>

#define DBC_FILE "items.dbc"

enum ZoneProperties
{
	ZONE_ID,
	ZONE_NAME,
	ZONE_TEXTURENAME
	//TEXTURESIZE?
};

enum EnemyProperties
{
	ENEMY_ID,
	ENEMY_ZONEID,
	ENEMY_NAME,
	ENEMY_HP,
	ENEMY_DMG,
	ENEMY_MODELNAME,
	ENEMY_TEXTURENAME
};


enum ItemProperties
{
	ITEM_ID,
	ITEM_NAME,
	ITEM_TYPE,
	ITEM_ABILITY_TYPE,
	ITEM_ABILITY_STAT,
	ITEM_WEAPON_DAMAGE
};

#define DBC_FIELD_COUNT ENEMY_TEXTURENAME+1
#define PROP_ID 0


class DBCHandler
{
	private:
		std::map<unsigned int, std::string[DBC_FIELD_COUNT]> enemiesMap;
		std::map<unsigned int, std::string[DBC_FIELD_COUNT]> itemsMap;

	public:
		void loadAllDBCs();

		EnemyObject* createEnemy(unsigned int mapKey, core::vector3df position, int ID = -1);
		
		DBCHandler();
		~DBCHandler();
	private:
		bool loadSingleDBC(std::string filename, std::map<unsigned int, std::string[DBC_FIELD_COUNT]>* entriesMap);
};

extern DBCHandler globalDBCHandler;
